local state = gstate.new()


function state:init()

end



function state:enter()
	introtext=
						"People weren't ready for what happened...\n"..
						"  The illness spread like wildfire,\n"..
						"bringing the country to it's knees.\n\n"..
						"  But the military had prepared for this\n"..
						"in secret.\n"..
						"  The orbital strikes struck the zombies\n"..
						"with millimeter precision.\n"..
						"  After only a handful of hours, no\n"..
						"zombie could move more than three meters\n"..
						"before being destroyed by the advanced\n"..
						"automatic defence system.\n"..
						"The plan was perfect...\n\n"..
						"          Almost...\n\n"..
						"  Like any other system, there only needs\n"..
						"to be one unpredictable weakness and\n"..
						"everything can be lost...\n\n"..
						"  One soldier, manning one of the many\n"..
						"missile control site, opens an email.\n"..
						"  This message offered exotic anatomy\n"..
						"enhancements. Intrigued and oblivious,\n"..
						"he unleashes a virus on the network\n"..
						"  The missiles started to strike at\n"..
						"random, creating cause and destruction\n"..
						"much worse than the crisis they were \n"..
						"meant to control.\n\n"..
						"An IT guy, with a USB thumbdrive, loaded\n"..
						"up with anti-virus software, takes the \n"..
						"wheel of his car, and set off for the\n"..
						"most glorious, and last, job of his\n"..
						"short career.\n\n"..
						"           Welcome to"

	capture = false
	moved = true
	love.mouse.setGrab(false)
	intromask = 0
	itguymask = 0
	miliguymask = 0
	zombieguymask = 0
	past = 0
end


function state:focus()

end


function state:mousepressed(x, y, btn)

end


function state:mousereleased(x, y, btn)
	
end


function state:joystickpressed(joystick, button)
	
end


function state:joystickreleased(joystick, button)
	
end


function state:quit()
	
end


function state:keypressed(key, uni)
	moved = true
	darkness:setLooping(true)
	gstate.switch(flybyscreen)
end


function state:keyreleased(key, uni)
	
end


function state:update(dt)
	--c[1].hitpoints = math.min(100,c[1].hitpoints+dt*(streak/10))
	past = (past or 0) + (dt)
	intromask = math.max(0,math.min(1,18-past))
	itguymask = math.max(0,math.min(1,33-past))-math.max(0,math.min(1,22-past))
	miliguymask = math.max(0,math.min(1,22-past))-math.max(0,math.min(1,14-past))
	zombieguymask = math.max(0,math.min(1,12-past))-math.max(0,math.min(1,6-past))
	
	updategame(dt)

	if past>42 then
		darkness:setLooping(true)
		gstate.switch(flybyscreen)
	end

	shake = math.min(1,math.max(shake-(dt), 0))
end

local maxZombies = 0
function state:draw()
	local r,g,b,a = love.graphics.getColor()
	love.graphics.setCanvas(overlay)
	love.graphics.setColor(0,0,0,255*intromask)
	love.graphics.rectangle("fill",0,0,midx*2,midy*2)
	love.graphics.setColor(255,255,255)
	love.graphics.print(introtext,midx-110,midy*2-past*15)
	love.graphics.draw(title,midx,(math.max(0,(((midy*2)/15)+22-past)*15)),0,1,1,itguy:getWidth())
	--love.graphics.print(math.floor(past*100)/100,10,10,0,2,2)
	love.graphics.setColor(255,255,255,255*(itguymask))
	love.graphics.draw(itguy,midx*2+20,midy*2,0,1,1,itguy:getWidth(),itguy:getHeight())
	love.graphics.draw(tdrive,midx*2-80,midy*2,0,1,1,tdrive:getWidth(),tdrive:getHeight())
	love.graphics.setColor(255,255,255,255*(miliguymask))
	love.graphics.draw(miliguy,-20,midy*2+30,0,1,1,0,miliguy:getHeight())

	love.graphics.setColor(255,255,255,255*(zombieguymask))
	love.graphics.draw(zombieguy,midx*2+30,midy*2+30,0,1,1,zombieguy:getWidth(),zombieguy:getHeight())
	love.graphics.setCanvas()
	drawgame()
	--]]
end

return state
